<template>
  <!-- 设置角色弹窗 -->
  <el-dialog title="角色设置" :visible.sync="dialogTableVisible">
    <el-form :model="form">
      <el-row :gutter="20">
        <el-col :span="24">
          <el-form-item label="用户名:" :label-width="formLabelWidth" prop="username">
            <el-input
              v-model="form.username"
              autocomplete="on1"
              class="dialog_ipt"
              size="mini"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <el-table
      :data="roleList"
      border
      style="width: 100%"
      size="mini"
      max-height="250px"
      @selection-change="handleSelectionChange"
    >
      <el-table-column type="selection" width="auto"></el-table-column>
      <el-table-column fixed prop="roleId" label="序号" width="50" resizable></el-table-column>
      <el-table-column prop="roleSet" label="用户编码" width="auto"></el-table-column>
      <el-table-column prop="roleName" label="角色名称" width="80"></el-table-column>

      <el-table-column prop="effectTime" label="生效日期" width="auto"></el-table-column>
      <el-table-column prop="uneffectTime" label="失效日期" width="auto"></el-table-column>
      <el-table-column prop="status" label="状态" width="70">
        <template slot-scope="scope">
          <!-- scope.row 可以取到当前一行的数据 -->
          <el-switch v-model="scope.row.status" active-value="1" inactive-value="0"></el-switch>
        </template>
      </el-table-column>
      <span slot="footer" class="dialog-footer">
        <el-button @click="close">取 消</el-button>
        <el-button type="primary" @click="btnOk">确 定</el-button>
      </span>
    </el-table>
  </el-dialog>
</template>

<script>
import { selectroleAPI } from '../api/roleAPI'
export default {
  data() {
    return {
      roleList: [],
      dialogTableVisible: true
    }
  },
  created() {
    this.getRoleList()
  },
  methods: {
    async getRoleList() {
      const result = await selectroleAPI()
      this.roleList = result.conditionlist
    }
  }
}
</script>

<style></style>
